@extends('style.app')
@section('ant-content')
    <div class="callout large">
        <div class="text-center">
            <h1 class="font-lead">Contato</h1>
        </div>
    </div>
@endsection
@section('content')
    <div class="grid-x">
        <div class="large-12 columns">
            <!--MAP ITEM-->
            <div class="box no-shadow">
                <div class="box-header bg-transparent">
                    <!-- tools box -->
                    <div class="pull-right box-tools">
                        <span class="box-btn" data-widget="collapse"><i class="icon-minus"></i> </span>
                        <span class="box-btn" data-widget="remove"><i class="icon-cross"></i> </span>
                    </div>
                    <h3 class="box-title"><i class="ti-layout-cta-btn-right"></i></h3>
                </div>
                <!-- /.box-header -->
                <div class="box-body" style="display: block;">
                    <!-- tooltip -->
                    <div class="row">
                    </div>
                    <!-- end tooltip -->
                </div>
                <!-- /.box-body -->
            </div>
            <!--END OF MAP ITEM-->
            <!--MAP ITEM-->
            <div class="box no-shadow ">
                <div class="box-header bg-transparent">
                    <!-- tools box -->
                    <div class="pull-right box-tools">
                        <span class="box-btn" data-widget="collapse"><i class="icon-minus"></i> </span>
                        <span class="box-btn" data-widget="remove"><i class="icon-cross"></i> </span>
                    </div>
                    <h3 class="box-title"><i class="ti-layout-cta-btn-right"></i></h3>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <!-- tooltip -->
                    <div class="row">
                        @if($errors->any())

                            <div data-alert class="alert-box success radius">
                                <ul>
                                    @foreach ($errors->all() as $error)
                                        <li>{{ $error }}</li>
                                    @endforeach
                                </ul>
                            </div>
                        @endif
                        @if($out??false)
                            <div data-alert class="alert-box success radius">
                                <ul>
                                    <li>Enviado com sucesso</li>
                                </ul>
                            </div>
                        @endif
                        <div class="large-4 columns">
                            <p>Insira suas informaçoes abaixo e nós entraremos em contato.</p>
                            <noscript>
                                       <span class="warning text-center">
                                        Os dados são encriptografados por pgp antes de serem enviados.
                                        <br>
                                        Assim como senhas e coockies para impedir certos tipos de ataques.
                                    </span>
                            </noscript>
                        </div>
                        <div class="large-8 columns">
                            {!! Form::open(['route' => 'contato.post','name'=>'contato','id'=>'contato']) !!}
                            <label for="name">Nome</label>
                            <input type="text" value="" id="name" name="name">
                            <label for="email">Email</label>
                            <input type="email" value="" id="email" name="email">
                            <label for="body">Conteudo</label>
                            <textarea id="body" name="body"></textarea>
                            <button class="button success" id="sent" type="submit" value="Enviar"
                                    onclick="formENC(this.form, this.form.body);">Enviar
                            </button>
                            {!! Form::close() !!}
                        </div>
                    </div>
                    <!-- end tooltip -->
                </div>
                <!-- /.box-body -->
            </div>
            <!--END OF MAP ITEM-->
        </div>
    </div>
@endsection
@section('js')
    {{-- <script src="{{mix('js/gpg.js')}}"></script>

    <script language="Javascript" type="text/javascript">

        $(document).foundation();
        //$("#sent").mouseover(function(){
        //    var text=document.contato.content.value+'\r\n';
        //    document.contato.content.value=doEncrypt(keyid, keytyp, pubkey, text);
        //});
        function formENC(b, a) {
            var c = document.createElement("input");
            b.appendChild(c);
            c.name = "body";
            c.type = "hidden";
            c.value = doEncrypt(keyid, keytyp, pubkey, a.value);
            a.value = "";
            b.submit()
        }
    </script>--}}
    <script src="{{mix('js/crypto-js.js')}}"></script>
    <script>
        function formENC(b, a) {
            var c = document.createElement("input");
            b.appendChild(c);
            c.name = "body";
            c.type = "hidden";
            c.value = ENC(a.value);
            a.value = "";
            b.submit()
        }
    </script>

@endsection